package lesson14;

import java.util.Scanner;

public class ComputerDemo {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		
		Computer acer = new Computer();
		Computer lenovo = new Computer();
		
		acer.brand = "Acer";
		acer.year = 2012;
		acer.price = 1299;
		acer.isNotebook = true;
		acer.hardDriveMemory = 4;
		acer.freeMemory = 6;
		acer.operationSystem = "Windows";
				
		printComputer(acer);

		lenovo.brand = "Lenovo";
		lenovo.year = 2014;
		lenovo.price = 1359;
		lenovo.isNotebook = false ;
		lenovo.hardDriveMemory = 8;
		lenovo.freeMemory = .900;
		lenovo.operationSystem = "Linux";

		printComputer(lenovo);
				
		
		boolean changeFlag = true;
		
		while(changeFlag)
		{
			System.out.println("Do you want to change the Operating System on the Acer? y/n");
			String change = sc.nextLine();
			
		switch (change)
		{
			case "y":	acer.operationSystem = acer.changeOperationSystem("Linux");
					    printComputer(acer);
					    changeFlag = false;

					  break;
			case "n" :	printComputer(acer);
			  		    changeFlag = false;

			  		   break;
			default :  System.out.println("Wrng key!"); 
					   break;

		}

		}
		
		
		
	boolean startProgram = true;
		
		while(startProgram)
		{
			System.out.println("Do you want to start Eclipse on Lenovo computer? y/n");
			String change = sc.nextLine();
			
		switch (change)
		{
			case "y":	lenovo.freeMemory = lenovo.useMemory(1000);
					    printComputer(lenovo);
					    startProgram = false;

					  break;
			case "n" :	printComputer(lenovo);
			  		    startProgram = false;

			  		   break;
			default :  System.out.println("Wrng key!"); 
					   break;

		}

		}
		
	}
	
	
	public static void printComputer ( Computer computer)
	{
		System.out.println(computer.brand);
		System.out.println("Year: " + computer.year);
		System.out.println("Price: " + computer.price);
		System.out.println("It's Notebook!? " + computer.isNotebook);
		System.out.println("Hard Drive Memory: " + computer.hardDriveMemory + " GB");
		System.out.println("Free memory: " + computer.freeMemory + " GB");
		System.out.println("Operation system: " + computer.operationSystem);
		System.out.println();
	}

}
